/**
 * *****************************************
 * Project: cone
 * File: StaticDispatcher.java
 * Creation Date: 9:33:01 PM
 * Creator: Ahmed Fawzy
 * *****************************************
 * Copyright © 2012 Devariance.
 */

package com.devariance.cone.servlet;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;

import com.devariance.cone.Constants;

/**
 * This controller is for handling requests for static contents.
 * 
 * @author Ahmed Fawzy
 * @version 1.0
 * 
 */
public class StaticDispatcher extends HttpServlet implements Filter {

	/**
	 * Unique Serialization Version.
	 */
	private static final long serialVersionUID = -4611589502586183201L;

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest,
	 * javax.servlet.ServletResponse, javax.servlet.FilterChain)
	 */
	@Override
	public void doFilter(final ServletRequest req, final ServletResponse resp,
			final FilterChain chain) throws IOException, ServletException {
		req.getServletContext().getRequestDispatcher(Constants.EMPTY_STRING)
				.forward(req, resp);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
	 */
	@Override
	public void init(final FilterConfig conf) throws ServletException {
		return;
	}
}
